package com.woniu.swagger.controller;

import com.woniu.swagger.common.Result;
import com.woniu.swagger.model.Guide;
import com.woniu.swagger.model.Product;
import com.woniu.swagger.model.ScatteredPassengers;
import com.woniu.swagger.model.User;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("admin")
@Api(tags = "管理员相关接口", description = "提供管理员相关的 Rest API")
public class AdminController {
    @ApiOperation(value ="退款")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "orderId", value = "订单id", dataType = "int")
    })
    @PostMapping("refund")
    public Result refund(int orderId){
        // 数据持久化
        return Result.success("退款成功");
    }

    @ApiOperation(value ="制定旅游团")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "productId", value = "产品id", dataType = "int"),
            @ApiImplicitParam(name = "peoNumb", value = "人数", dataType = "int"),
            @ApiImplicitParam(name = "startTime", value = "出发时间", dataType = "Timestamp")
    })
    @PostMapping("makeTourGroups")
    public Result makeTourGroups(int productId, int peoNumb, Timestamp startTime){
        // 数据持久化
        return Result.success("制定旅行团成功");
    }

    @ApiOperation(value ="制定产品")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "productName", value = "产品名称", dataType = "String"),
            @ApiImplicitParam(name = "productIntro", value = "产品简介", dataType = "String"),
            @ApiImplicitParam(name = "productScheduing", value = "产品行程安排", dataType = "String"),
            @ApiImplicitParam(name = "productCostIncludes", value = "产品费用包含", dataType = "String"),
            @ApiImplicitParam(name = "productPrice", value = "产品价格", dataType = "double"),
            @ApiImplicitParam(name = "productMinPeople", value = "最低开团人数", dataType = "int"),
            @ApiImplicitParam(name = "productType", value = "产品类型", dataType = "String"),
            @ApiImplicitParam(name = "productImg_urls", value = "产品图像地址集合", dataType = "List<String>")
    })
    @PostMapping("makeProduct")
    public Result makeProduct(String productName,String productIntro,String productScheduing,String productCostIncludes,
                              double productPrice,int productMinPeople,String productType,List<String> productImg_urls){
        // 新增产品数据库持久化返回自增id
        // 通过获取的产品id，录入产品图片表中持久化
        return Result.success("制定产品成功");
    }

    @ApiOperation(value ="新增导游")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "guideName", value = "导游名称", dataType = "String"),
            @ApiImplicitParam(name = "guideStatus", value = "导游状态", dataType = "String"),
            @ApiImplicitParam(name = "guideNumber", value = "导游次数", dataType = "int"),
            @ApiImplicitParam(name = "guideImg", value = "导游头像", dataType = "String"),
            @ApiImplicitParam(name = "guideComplain", value = "投诉次数", dataType = "int")
    })
    @PostMapping("addGuide")
    public Result addGuide(String guideName,String guideStatus,int guideNumber,String guideImg,int guideComplain){
        // 数据持久化
        return Result.success("新增导游成功");
    }

    @ApiOperation(value ="选择导游")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "guideId" ,value = "导游id",dataType = "int"),
            @ApiImplicitParam(name = "tourId" ,value = "团id",dataType = "int")
    })
    @PostMapping("chooseGuide")
    public Result chooseGuide(int guideId,int tourId){
        return Result.success("选择成功");
    }

    @ApiOperation(value ="结束旅行团")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "tourId" ,value = "团id",dataType = "int")
    })
    @PostMapping("finishTour")
    public Result finishTour(int tourId){
        return Result.success("结束成功");
    }

    // 动态sql
    @ApiOperation(value ="查看导游所有信息（状态等）")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "guideStatus", value = "导游状态", dataType = "String"),
            @ApiImplicitParam(name = "guideName", value = "导游姓名", dataType = "String")
    })
    @GetMapping("getGuide")
    public Result getGuide(String guideStatus, String guideName){
        // 动态sql查询
        List<Guide> guils = new ArrayList<>();
        return Result.success(guils);
    }

    @ApiOperation(value ="确认开团")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "groupId", value = "团id", dataType = "int"),
            @ApiImplicitParam(name = "peoNumb", value = "团队人数", dataType = "int"),
            @ApiImplicitParam(name = "groupType", value = "团队类型", dataType = "String")
    })
    @PostMapping("openGroup")
    public Result openGroup(int groupId, int peoNumb, String groupType){
        // 数据持久化
        return Result.success("确认开团成功");
    }
    @ApiOperation(value ="管理员登录")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userName", value = "用户名", dataType = "String"),
            @ApiImplicitParam(name = "userPassword", value = "用户密码", dataType = "String"),
            @ApiImplicitParam(name = "code", value = "验证码", dataType = "String")
    })
    @GetMapping("adminLogin")
    public Result adminLogin(String userName,String userPassword,String code){
        // 数据持久化
        return Result.success("登录成功");
    }


    @ApiOperation(value ="审核酒店")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "adminId", value = "管理员id", dataType = "int"),
            @ApiImplicitParam(name = "hotelId", value = "酒店id", dataType = "int"),
            @ApiImplicitParam(name = "text", value = "审核内容", dataType = "String")
    })
    @PutMapping("hotelAudit")
    public Result hotelAudit(int adminId,int hotelId,String text){
        // 数据持久化
        return Result.success("审核完成");
    }


    @ApiOperation(value ="审核景点")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "adminId", value = "管理员id", dataType = "int"),
            @ApiImplicitParam(name = "spotId", value = "景点id", dataType = "int"),
            @ApiImplicitParam(name = "text", value = "审核内容", dataType = "String")
    })
    @PutMapping("spotAudit")
    public Result spotAudit(int adminId,int spotId,String text){
        // 数据持久化
        return Result.success("审核完成");
    }


    @ApiOperation(value ="下架酒店")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "adminId", value = "管理员id", dataType = "int"),
            @ApiImplicitParam(name = "hotelId", value = "酒店id", dataType = "int"),
            @ApiImplicitParam(name = "text", value = "下架原因", dataType = "String")
    })
    @PutMapping("hotelDel")
    public Result hotelDel(int adminId,int hotelId,String text){
        // 数据持久化
        return Result.success("下架完成");
    }


    @ApiOperation(value ="下架景点")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "adminId", value = "管理员id", dataType = "int"),
            @ApiImplicitParam(name = "spotId", value = "景点id", dataType = "int"),
            @ApiImplicitParam(name = "text", value = "下架原因", dataType = "String")
    })
    @PutMapping("spotDel")
    public Result spotDel(int adminId,int spotId,String text){
        // 数据持久化
        return Result.success("下架完成");
    }


    @ApiOperation(value ="证件过期推送")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userId", value = "用户id", dataType = "int"),
            @ApiImplicitParam(name = "cardName", value = "证件名", dataType = "String")
    })
    @GetMapping("cardOverdue")
    public Result cardOverdue(int userId,String cardName){
        // 数据持久化
        return Result.success("过期推送完成");
    }


    @ApiOperation(value ="热门旅游团推送")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "text", value = "推送内容", dataType = "String")
    })
    @GetMapping("pushHotText")
    public Result pushHotText(String text){
        // 数据持久化
        return Result.success("推送完成");
    }

    @ApiOperation(value ="预定成功推送")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "text", value = "推送内容", dataType = "String"),
            @ApiImplicitParam(name = "userId", value = "用户id", dataType = "int")
    })
    @GetMapping("pushSucText")
    public Result pushSucText(String text,int userId){
        // 数据持久化
        return Result.success("推送完成");
    }


    @ApiOperation(value ="开团信息通知")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "tourId", value = "团id", dataType = "int"),
            @ApiImplicitParam(name = "text", value = "通知内容", dataType = "String")
    })
    @GetMapping("pushNotice")
    public Result pushNotice(int tourId,String text){
        // 数据持久化
        return Result.success("通知完成");
    }


    @ApiOperation(value ="判断是否满足开团条件")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "time", value = "团日期", dataType = "Timestamp"),
            @ApiImplicitParam(name = "count", value = "人数", dataType = "int")
    })
    @GetMapping("judgeCount")
    public Result judgeCount(Timestamp time, int count){
        // 数据持久化
        return Result.success("判断完成");
    }


    @ApiOperation(value ="录入散客信息")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "travelerId", value = "出行人id", dataType = "int"),
            @ApiImplicitParam(name = "orderId", value = "订单id", dataType = "int"),
            @ApiImplicitParam(name = "tourId", value = "团id", dataType = "int"),
            @ApiImplicitParam(name = "cooperatorId", value = "旅行社id", dataType = "int"),
            @ApiImplicitParam(name = "cooperatorRatio", value = "分佣比例", dataType = "double")
    })
    @GetMapping("addScatteredPassengers")
    public Result addScatteredPassengers(int travelerId, int orderId,int tourId,int cooperatorId,double cooperatorRatio){
        // 数据持久化
        return Result.success("添加完成");
    }




}
